<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>motrackers.utils.filechooser_utils &mdash; Multi-object trackers in Python 1.0.0 documentation</title>
      <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
      <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" />
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script src="../../../_static/doctools.js"></script>
        <script src="../../../_static/sphinx_highlight.js"></script>
    <script src="../../../_static/js/theme.js"></script>
    <link rel="index" title="Index" href="../../../genindex.html" />
    <link rel="search" title="Search" href="../../../search.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
            <a href="../../../index.html" class="icon icon-home"> Multi-object trackers in Python
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <ul>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/readmefile.html">Multi-object trackers in Python</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/readmefile.html#example-tf-mobilenetssd-centroidtracker">Example: <cite>TF-MobileNetSSD + CentroidTracker</cite></a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/readmefile.html#example-yolov3-centroidtracker">Example: <cite>YOLOv3 + CentroidTracker</cite></a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/apidocuments.html">Tracker</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/apidocuments.html#sort">SORT</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/apidocuments.html#iou-tracker">IOU Tracker</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/apidocuments.html#kalman-filter-based-centroid-tracker">Kalman Filter based Centroid Tracker</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/apidocuments.html#tracks">Tracks</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/apidocuments.html#kalman-filters">Kalman Filters</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/apidocuments.html#object-detection">Object Detection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/apidocuments.html#utilities">Utilities</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/apidocuments.html#references-and-credits">References and Credits</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../includeme/apidocuments.html#contributor-covenant-code-of-conduct">Contributor Covenant Code of Conduct</a></li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../index.html">Multi-object trackers in Python</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../../index.html" class="icon icon-home"></a> &raquo;</li>
          <li><a href="../../index.html">Module code</a> &raquo;</li>
      <li>motrackers.utils.filechooser_utils</li>
      <li class="wy-breadcrumbs-aside">
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <h1>Source code for motrackers.utils.filechooser_utils</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">ipyfilechooser</span> <span class="kn">import</span> <span class="n">FileChooser</span>


<div class="viewcode-block" id="create_filechooser"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.create_filechooser">[docs]</a><span class="k">def</span> <span class="nf">create_filechooser</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">html_title</span><span class="o">=</span><span class="s2">&quot;Select File&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">fc</span> <span class="o">=</span> <span class="n">FileChooser</span><span class="p">(</span><span class="n">default_path</span><span class="p">)</span>
    <span class="n">fc</span><span class="o">.</span><span class="n">title</span> <span class="o">=</span> <span class="n">html_title</span>
    <span class="n">fc</span><span class="o">.</span><span class="n">use_dir_icons</span> <span class="o">=</span> <span class="n">use_dir_icons</span>
    <span class="k">return</span> <span class="n">fc</span></div>


<div class="viewcode-block" id="select_caffemodel_prototxt"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.select_caffemodel_prototxt">[docs]</a><span class="k">def</span> <span class="nf">select_caffemodel_prototxt</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">html_title</span> <span class="o">=</span> <span class="s1">&#39;&lt;b&gt;Select &lt;code&gt;.prototxt&lt;/code&gt; file for the caffemodel:&lt;/b&gt;&#39;</span>
    <span class="n">fc</span> <span class="o">=</span> <span class="n">create_filechooser</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="n">default_path</span><span class="p">,</span>
                            <span class="n">html_title</span><span class="o">=</span><span class="n">html_title</span><span class="p">,</span>
                            <span class="n">use_dir_icons</span><span class="o">=</span><span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">fc</span></div>


<div class="viewcode-block" id="select_caffemodel_weights"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.select_caffemodel_weights">[docs]</a><span class="k">def</span> <span class="nf">select_caffemodel_weights</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">html_title</span> <span class="o">=</span> <span class="s1">&#39;&lt;b&gt;Select caffemodel weights (file with extention &lt;code&gt;.caffemodel&lt;/code&gt;):&lt;/b&gt;&#39;</span>
    <span class="n">fc</span> <span class="o">=</span> <span class="n">create_filechooser</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="n">default_path</span><span class="p">,</span>
                            <span class="n">html_title</span><span class="o">=</span><span class="n">html_title</span><span class="p">,</span>
                            <span class="n">use_dir_icons</span><span class="o">=</span><span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">fc</span></div>


<div class="viewcode-block" id="select_caffemodel"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.select_caffemodel">[docs]</a><span class="k">def</span> <span class="nf">select_caffemodel</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">prototxt</span> <span class="o">=</span> <span class="n">select_caffemodel_prototxt</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="n">default_path</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="n">weights</span> <span class="o">=</span> <span class="n">select_caffemodel_weights</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="n">default_path</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">prototxt</span><span class="p">,</span> <span class="n">weights</span></div>


<div class="viewcode-block" id="select_videofile"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.select_videofile">[docs]</a><span class="k">def</span> <span class="nf">select_videofile</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">html_title</span> <span class="o">=</span> <span class="s1">&#39;&lt;b&gt;Select video file:&lt;/b&gt;&#39;</span>
    <span class="n">fc</span> <span class="o">=</span> <span class="n">create_filechooser</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="n">default_path</span><span class="p">,</span>
                            <span class="n">html_title</span><span class="o">=</span><span class="n">html_title</span><span class="p">,</span>
                            <span class="n">use_dir_icons</span><span class="o">=</span><span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">fc</span></div>


<div class="viewcode-block" id="select_yolo_weights"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.select_yolo_weights">[docs]</a><span class="k">def</span> <span class="nf">select_yolo_weights</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">html_title</span> <span class="o">=</span> <span class="s1">&#39;&lt;b&gt;Select YOLO weights (&lt;code&gt;.weights&lt;/code&gt; file):&lt;/b&gt;&#39;</span>
    <span class="n">fc</span> <span class="o">=</span> <span class="n">create_filechooser</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="n">default_path</span><span class="p">,</span>
                            <span class="n">html_title</span><span class="o">=</span><span class="n">html_title</span><span class="p">,</span>
                            <span class="n">use_dir_icons</span><span class="o">=</span><span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">fc</span></div>


<div class="viewcode-block" id="select_coco_labels"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.select_coco_labels">[docs]</a><span class="k">def</span> <span class="nf">select_coco_labels</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">html_title</span> <span class="o">=</span> <span class="s1">&#39;&lt;b&gt;Select coco labels file (&lt;code&gt;.name&lt;/code&gt; file):&lt;/b&gt;&#39;</span>
    <span class="n">fc</span> <span class="o">=</span> <span class="n">create_filechooser</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="n">default_path</span><span class="p">,</span>
                            <span class="n">html_title</span><span class="o">=</span><span class="n">html_title</span><span class="p">,</span>
                            <span class="n">use_dir_icons</span><span class="o">=</span><span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">fc</span></div>


<div class="viewcode-block" id="select_yolo_config"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.select_yolo_config">[docs]</a><span class="k">def</span> <span class="nf">select_yolo_config</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">html_title</span> <span class="o">=</span> <span class="s1">&#39;&lt;b&gt;Choose YOLO config file (&lt;code&gt;.cfg&lt;/code&gt; file):&lt;/b&gt;&#39;</span>
    <span class="n">fc</span> <span class="o">=</span> <span class="n">create_filechooser</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="n">default_path</span><span class="p">,</span>
                            <span class="n">html_title</span><span class="o">=</span><span class="n">html_title</span><span class="p">,</span>
                            <span class="n">use_dir_icons</span><span class="o">=</span><span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">fc</span></div>


<div class="viewcode-block" id="select_yolo_model"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.select_yolo_model">[docs]</a><span class="k">def</span> <span class="nf">select_yolo_model</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">yolo_weights</span> <span class="o">=</span> <span class="n">select_yolo_weights</span><span class="p">(</span><span class="n">default_path</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="n">yolo_config</span> <span class="o">=</span> <span class="n">select_yolo_config</span><span class="p">(</span><span class="n">default_path</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="n">coco_names</span> <span class="o">=</span> <span class="n">select_coco_labels</span><span class="p">(</span><span class="n">default_path</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">yolo_weights</span><span class="p">,</span> <span class="n">yolo_config</span><span class="p">,</span> <span class="n">coco_names</span></div>


<div class="viewcode-block" id="select_pbtxt"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.select_pbtxt">[docs]</a><span class="k">def</span> <span class="nf">select_pbtxt</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">html_title</span> <span class="o">=</span> <span class="s1">&#39;&lt;b&gt;Select &lt;code&gt;.pbtxt&lt;/code&gt; file:&lt;/b&gt;&#39;</span>
    <span class="n">fc</span> <span class="o">=</span> <span class="n">create_filechooser</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="n">default_path</span><span class="p">,</span>
                            <span class="n">html_title</span><span class="o">=</span><span class="n">html_title</span><span class="p">,</span>
                            <span class="n">use_dir_icons</span><span class="o">=</span><span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">fc</span></div>


<div class="viewcode-block" id="select_tfmobilenet_weights"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.select_tfmobilenet_weights">[docs]</a><span class="k">def</span> <span class="nf">select_tfmobilenet_weights</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">html_title</span> <span class="o">=</span> <span class="s1">&#39;&lt;b&gt;Select tf-frozen graph of mobilenet (&lt;code&gt;.pb&lt;/code&gt; file):&lt;/b&gt;&#39;</span>
    <span class="n">fc</span> <span class="o">=</span> <span class="n">create_filechooser</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="n">default_path</span><span class="p">,</span>
                            <span class="n">html_title</span><span class="o">=</span><span class="n">html_title</span><span class="p">,</span>
                            <span class="n">use_dir_icons</span><span class="o">=</span><span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">fc</span></div>


<div class="viewcode-block" id="select_tfmobilenet"><a class="viewcode-back" href="../../../includeme/apidocuments.html#motrackers.utils.filechooser_utils.select_tfmobilenet">[docs]</a><span class="k">def</span> <span class="nf">select_tfmobilenet</span><span class="p">(</span><span class="n">default_path</span><span class="o">=</span><span class="s2">&quot;~/&quot;</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
    <span class="n">prototxt</span> <span class="o">=</span> <span class="n">select_pbtxt</span><span class="p">(</span><span class="n">default_path</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="n">tfweights</span> <span class="o">=</span> <span class="n">select_tfmobilenet_weights</span><span class="p">(</span><span class="n">default_path</span><span class="p">,</span> <span class="n">use_dir_icons</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">prototxt</span><span class="p">,</span> <span class="n">tfweights</span></div>
</pre></div>

           </div>
          </div>
          <footer>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2021, Aditya M. Deshpande.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>